package pl.agh.pp.zephyr.model;

import java.util.Collections;
import java.util.HashSet;
import java.util.Set;

import pl.agh.pp.zephyr.integration.McuController;
import pl.agh.pp.zephyr.utils.parser.HTMLParser;

/**
 * Reprezentuje mikser mcu.
 * */
public class Mcu extends Host {
	
	public String getPrefix() {
		return prefix;
	}

	// prefix MCU w GK
	public final String prefix;
	
	// port http MCU
	public final String httpPort;
	
	// referencja na kontroler TODO chyba to trzeba wywalić (warstwy)
	public final McuController controller;

	// zbiór pokoi
	public final Set<Room> rooms = Collections
			.synchronizedSet(new HashSet<Room>());

	public Mcu(String ip, String port, String prefix, String httpPort, McuController controller) {
		super(ip, port);
		this.prefix = prefix;
		this.httpPort = httpPort;
		this.controller = controller;
	}

	public int getLoad() {
		return HTMLParser.getMCUStatus("http://" + ip + ":" + httpPort + "/Status")
				.getConnectionsCount();
	}
}
